Repository navigation
id(search): memoize subject_kind resolution in search_terms (#3013) - #3688
Conversation
search_terms documented subject_kind as called at most once per subject, but its per-term loop re-filtered every subject through the lookup for each SubjectKind term (N subjects x K kind terms calls). Resolve each subject kind once into a memo (including the unresolvable None) and let every kind term read it; AND results are unchanged. Adds a counting-lookup test: 3 subjects x 3 kind terms (one duplicated) resolve exactly 3 lookups, and a single kind term still returns the same subjects.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🤖 Salvage note (duplicate-PR protocol, from the #6608 pr-shepherd pass, Lane W fallback mode) This PR is the canonical landing of queue task 5518 for issue #3013. The duplicate, PR #3678 (same task, same base blob
Conclusion: nothing unique to salvage from PR #3678; it is being closed as superseded by this PR. |
Fixes #3013 (queue task 5518).
search_termsdocumentssubject_kindas 'called at most once per subject', but its per-term loop re-filtered all subjects through the lookup for everySubjectKindterm — N subjects × K kind terms calls, each a store read on thesearch_store_termspath.Change (pkgs/id/src/search.rs): resolve each subject's kind once into a memo inside
search_terms(the unresolvableNoneis memoised too) and let every kind term read the memo. AND results are identical; only the lookup count changes.Test (pkgs/id/tests/search.rs): new counting-lookup test — 3 subjects × 3 kind terms (one duplicated) perform exactly 3 lookups (was 9), and a single kind term returns the same subjects as before. Existing kind tests cover the unchanged semantics.
Verification: targeted
cargo test --test search test_search_running on the laptop at push time (fleet load is high today); CI on this PR is the check of record per fleet policy.Need help on this PR? Tag
@codesmith-botwith what you need.